<template>
  <keep-alive>
    <component :is="loadComponent()" :info="info"></component>
  </keep-alive>
</template>

<script>
import card1 from './card1';
import card2 from './card2';
import card3 from './card3';
export default {
  name: 'card',
  components: {
    card1,
    card2,
    card3
  },
  props: {
    info: {
      type: Object,
      default: {}
    },
    type: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      list: []
    };
  },
  created() {
    this.list = [{
      type: "FG0_USE0_1&N_01_SystemShowOneVo",
      name: "card1"
    }, {
      type: "FG0_USE0_1&B_02_SystemShowOneVo",
      name: "card2"
    }, {
      type: "FG0_USE1_1&N_00012_SystemShowOneVo",
      name: "card3"
    }]
  },
  methods: {
    loadComponent() {
      let name = '';
      let obj = this.list.find(item => {
        return item.type == this.type;
      })
      if(obj) {
        name = obj.name;
      }
      return name || 'card1';
    },
  }
}
</script>
